package facilius.controller.action.curso;

import facilius.model.ServiceLocator;
import java.util.HashMap;
import java.util.Map;
import org.mentawai.core.BaseAction;

/**
 *
 * @author Graciano
 */
public class CursoReadAction extends BaseAction{

    @Override
    public String execute() throws Exception {
        String consequence = ERROR;
        try {

            String criteriaNome = input.getString("nome");
            Map<String,Object> criteria = new HashMap<String, Object>();

            if ( criteria != null){
                criteria.put("nome", criteriaNome);
            }
            output.setValue("pojos", ServiceLocator.getCursoService().readByCriteria(criteria));

            consequence = SUCCESS;
        } catch (Exception e) {
            e.printStackTrace();
        }
        
        return consequence;
    }

}
